home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / term.info < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  14.4 KB  |  437 lines

  1. This is Info file ../info/term.info, produced by Makeinfo-1.55 from the
  2. input file term.texi.
  3.  
  4. 
  5. File: term.info,  Node: Top,  Prev: (DIR)
  6.  
  7. Terminal emulator mode
  8. **********************
  9.  
  10.    This is some notes about the term Emacs mode.
  11.  
  12. * Menu:
  13.  
  14. * term mode::
  15.  
  16. 
  17. File: term.info,  Node: term mode,  Prev: Top,  Up: Top
  18.  
  19. Term Mode
  20. *********
  21.  
  22. * Menu:
  23.  
  24. * Overview::
  25. * Connecting to remote computers::
  26. * Paging::
  27. * Terminal escapes::
  28.  
  29.    The `term' package includes the major modes `term', `shell', and
  30. `gud' (for running gbd or another debugger).  It is a replacement for
  31. the comint mode of Emacs 19, as well as shell, gdb, terminal, and
  32. telnet modes.  The package works best with recent releases of Emacs 19,
  33. but will also work reasonably well with Emacs 18 as well as Lucid Emacs
  34. 19.
  35.  
  36.    The file `nshell.el' is a wrapper to use unless term mode is built
  37. into Emacs.  If works around some of the missing in older Emacs
  38. versions.  To use it, edit the paths in `nshell.el', appropriately, and
  39. then `M-x load-file nshell.el RET'.  This will also load in replacement
  40. shell and gud modes.
  41.  
  42. 
  43. File: term.info,  Node: Overview,  Next: Connecting to remote computers,  Up: term mode
  44.  
  45. Overview
  46. ========
  47.  
  48.    The `term' mode is used to control a program (an "inferior process").
  49. It sends most keyboard input characters to the program, and displays
  50. output from the program in the buffer.  This is similar to the
  51. traditional comint mode, and modes derived from it (such as shell and
  52. gdb modes).  You can do with the new term-based shell the same sort of
  53. things you could do with the old shell mode, using more or less the
  54. same interface.  However, the new mode is more flexible, and works
  55. somewhat differently.
  56.  
  57. * Menu:
  58.  
  59. * Output from the inferior::
  60. * subbuffer:: The sub-buffer
  61. * altsubbuffer:: The alternate sub-buffer
  62. * Input to the inferior::
  63.  
  64. 
  65. File: term.info,  Node: Output from the inferior,  Next: subbuffer,  Up: Overview
  66.  
  67. Output from the inferior
  68. ------------------------
  69.  
  70.    In typical usage, output from the inferior is added to the end of
  71. the buffer.  If needed, the window will be scrolled, just like a
  72. regular terminal.  (Only one line at a time will be scrolled, just like
  73. regular terminals, and in contrast to the old shell mode.) Thus the
  74. buffer becomes a log of your interaction with the inferior, just like
  75. the old shell mode.
  76.  
  77.    Like a real terminal, term maintains a "cursor position." This is
  78. the `process-mark' of the inferior process.  If the process-mark is not
  79. at the end of the buffer, output from the inferior will overwrite
  80. existing text in the buffer.  This is like a real terminal, but unlike
  81. the old shell mode (which inserts the output, instead of overwriting).
  82.  
  83.    Some programs (such as Emacs itself) need to control the appearance
  84. on the screen in detail.  They do this by sending special control
  85. codes.  The exact control codes needed from terminal to terminal, but
  86. nowadays most terminals and terminal emulators (including xterm)
  87. understand the so-called "ANSI escape sequences" (first popularized by
  88. the Digital's VT100 family of terminal).  The term mode also
  89. understands these escape sequences, and for each control code does the
  90. appropriate thing to change the buffer so that the appearance of the
  91. window will match what it would be on a real terminal.  (In contrast,
  92. the old shell mode doesn't handle terminal control codes at all.)
  93.  
  94.    See <...> for the specific control codes.
  95.  
  96. 
  97. File: term.info,  Node: subbuffer,  Next: altsubbuffer,  Prev: Output from the inferior,  Up: Overview
  98.  
  99. The sub-buffer
  100. --------------
  101.  
  102.    A program that talks to terminal expects the terminal to have a
  103. fixed size.  If the program is talking a terminal emulator program such
  104. as `xterm', that size can be changed (if the xterm window is re-sized),
  105. but programs still assume a logical terminal that has a fixed size
  106. independent of the amount of output transmitted by the programs.
  107.  
  108.    To programs that use it, the Emacs terminal emulator acts as if it
  109. too has a fixed size.  The "sub-buffer" is the part of a `term'-mode
  110. buffer that corresponds to a "normal" terminal.  Most of the time
  111. (unless you explicitly scroll the window displaying the buffer), the
  112. sub-buffer is the part of the buffer that is displayed in a window.
  113.  
  114.    The sub-buffer is defined in terms of three buffer-local-variable:
  115.  
  116.  - Variable: term-height
  117.      The height of the sub-buffer, in screen lines.
  118.  
  119.  - Variable: term-width
  120.      The width of the sub-buffer, in screen columns.
  121.  
  122.  - Variable: term-home-marker
  123.      The "home" position, that is the top left corner of the sub-buffer.
  124.  
  125.    The sub-buffer is assumed to be the end part of the buffer; the
  126. `term-home-marker' should never be more than `term-height' screen lines
  127. from the end of the buffer.
  128.  
  129. 
  130. File: term.info,  Node: altsubbuffer,  Next: Input to the inferior,  Prev: subbuffer,  Up: Overview
  131.  
  132. The alternate sub-buffer
  133. ------------------------
  134.  
  135.    When a "graphical" program finishes, it is nice to restore the
  136. screen state to what it was before the program started.  Many people
  137. are used to this behavior from `xterm', and its also offered by the
  138. `term' emulator.
  139.  
  140.  - Function: term-switch-to-alternate-sub-buffer SET
  141.      If SET is true, and we're not already using the alternate
  142.      sub-buffer, switch to it.  What this means is that the
  143.      `term-home-marker' is saved (in the variable
  144.      `term-saved-home-marker'), and the `term-home-marker' is set to
  145.      the end of the buffer.
  146.  
  147.      If SET is false and we're using the alternate sub-buffer, switch
  148.      back to the saved sub-buffer.  What this means is that the
  149.      (current, alternate) sub-buffer is deleted (using `(delete-region
  150.      term-home-marker (point-max))'), and then the `term-home-marker'
  151.      is restored (from `term-saved-home-marker').
  152.  
  153. 
  154. File: term.info,  Node: Input to the inferior,  Prev: altsubbuffer,  Up: Overview
  155.  
  156. Input to the inferior
  157. ---------------------
  158.  
  159.    Characters typed by the user are sent to the inferior.  How this is
  160. done depends on whether the `term' buffer is in "character" mode or
  161. "line" mode.  (A `term' buffer can also be in "pager" mode.  This is
  162. discussed <later>.) Which of these is currently active is specified in
  163. the mode line.  The difference between them is the key-bindings
  164. available.
  165.  
  166.    In character mode, one character (by default C-c) is special, and is
  167. a prefix for various commands.  All other characters are sent directly
  168. to the inferior process, with no interpretation by Emacs.  Character
  169. mode looks and feels like a real terminal, or a conventional terminal
  170. emulator such as xterm.
  171.  
  172.    In line mode, key commands mostly have standard Emacs actions.
  173. Regulars characters insert themselves into the buffer.  When return is
  174. typed, the entire current line of the buffer (except possibly the
  175. prompt) is sent to the inferior process.  Line mode is basically the
  176. original shell mode from earlier Emacs versions.
  177.  
  178.    To switch from line mode to character mode type `C-c c'.  To switch
  179. from character mode to line mode type `C-c l'.
  180.  
  181.    In either mode, "echoing" of user input is handled by the inferior.
  182. Therefor, in line mode after an input line at the end of the buffer is
  183. sent to the inferior, it is deleted from the buffer.  This is so that
  184. the inferior can echo the input, if it wishes (which it normally does).
  185.  
  186. 
  187. File: term.info,  Node: Connecting to remote computers,  Next: Paging,  Prev: Overview,  Up: term mode
  188.  
  189. Connecting to remote computers
  190. ==============================
  191.  
  192.    If you want to login to a remove computer, you can do that just as
  193. you would expect, using whatever commands you would normally use.
  194.  
  195.    (This is worth emphasizing, because earlier versions of `shell' mode
  196. would not work properly if you tried to log in to some other computer,
  197. because of the way echoing was handled.  That is why there was a
  198. separate `telnet' mode to partially compensate for these problems.  The
  199. `telnet' mode is no longer needed, and is basically obsolete.)
  200.  
  201.    A program that asks you for a password will normally suppress
  202. echoing of the password, so the password will not show up in the buffer.
  203. This will happen just as if you were using a real terminal, if the
  204. buffer is in char mode.  If it is in line mode, the password will be
  205. temporarily visible, but will be erased when you hit return.  (This
  206. happens automatically; there is no special password processing.)
  207.  
  208.    When you log in to a different machine, you need to specify the type
  209. of terminal your using.   If you are talking to a Bourne-compatible
  210. shell, and your system understands the `TERMCAP' variable, you can use
  211. the command `M-x shell-send-termcap', which sends a string specifying
  212. the terminal type and size.  (This command is also useful after the
  213. window has changed size.)
  214.  
  215.    If you need to specify the terminal type manually, you can try the
  216. terminal types "ansi" or "vt100".
  217.  
  218.    You can of course run gdb on that remote computer.  One useful
  219. trick:  If you invoke gdb with the `--fullname' option, it will send
  220. special commands to Emacs that will cause Emacs to pop up the source
  221. files you're debugging.  This will work whether or not gdb is running
  222. on a different computer than Emacs, assuming can access the source
  223. files specified by gdb.
  224.  
  225. 
  226. File: term.info,  Node: Paging,  Next: Terminal escapes,  Prev: Connecting to remote computers,  Up: term mode
  227.  
  228. Paging
  229. ======
  230.  
  231.    When the pager is enabled, Emacs will "pause" after each screenful
  232. of output (since the last input sent to the inferior).  It will enter
  233. "pager" mode, which feels a lot like the "more" program:  Typing a
  234. space requests another screenful of output.  Other commands request
  235. more or less output, or scroll backwards in the `term' buffer.  In
  236. pager mode, type `h' or `?' to display a help message listing all the
  237. available pager mode commands.
  238.  
  239.    In either character or line mode, type `C-c p' to enable paging, and
  240. `C-c D' to disable it.
  241.  
  242. 
  243. File: term.info,  Node: Terminal escapes,  Prev: Paging,  Up: term mode
  244.  
  245. Terminal Escape sequences
  246. =========================
  247.  
  248.    A program that does "graphics" on a terminal controls the terminal
  249. by sending strings called "terminal escape sequences" that the terminal
  250. (or terminal emulator) interprets as special commands.  The `term' mode
  251. includes a terminal emulator that understands standard ANSI escape
  252. sequences, originally popularized by VT100 terminals, and now used by
  253. the `xterm' program and most modern terminal emulator software.
  254.  
  255. * Menu:
  256.  
  257. * Cursor motion:: Escape sequences to move the cursor
  258. * Erasing:: Escape commands for erasing text
  259. * Inserting and deleting:: Escape sequences to insert and delete text
  260. * Scrolling:: Escape sequences to scroll part of the visible window
  261. * Command hook::
  262. * Miscellaneous escapes::
  263.  
  264.    printing chars
  265.  
  266.    tab
  267.  
  268.    LF
  269.  
  270. 
  271. File: term.info,  Node: Cursor motion,  Next: Erasing,  Up: Terminal escapes
  272.  
  273. Escape sequences to move the cursor
  274. -----------------------------------
  275.  
  276. RETURN
  277.      Moves to the beginning of the current screen line.
  278.  
  279. C-b
  280.      Moves backwards one column.  (Tabs are broken up if needed.)
  281.  
  282. Esc [ R ; C H
  283.      Move to screen row R, screen column C, where (R=1) is the top row,
  284.      and (C=1) is the leftmost column.  Defaults are R=1 and C=1.
  285.  
  286. Esc [ N A
  287.      Move N (default 1) screen lines up.
  288.  
  289. Esc [ N B
  290.      Move N (default 1) screen lines down.
  291.  
  292. Esc [ N C
  293.      Move N (default 1) columns right.
  294.  
  295. Esc [ N D
  296.      Move N (default 1) columns left.
  297.  
  298. 
  299. File: term.info,  Node: Erasing,  Next: Inserting and deleting,  Prev: Cursor motion,  Up: Terminal escapes
  300.  
  301. Escape commands for erasing text
  302. --------------------------------
  303.  
  304.    These commands "erase" part of the sub-buffer.  Erasing means
  305. replacing by white space; it is not the same as deleting.  The relative
  306. screen positions of things that are not erased remain unchanged with
  307. each other, as does the relative cursor position.
  308.  
  309. E [ J
  310.      Erase from cursor to end of screen.
  311.  
  312. E [ 0 J
  313.      Same as E [ J.
  314.  
  315. E [ 1 J
  316.      Erase from home position to point.
  317.  
  318. E [ 2 J
  319.      Erase whole sub-buffer.
  320.  
  321. E [ K
  322.      Erase from point to end of screen line.
  323.  
  324. E [ 0 K
  325.      Same as E [ K.
  326.  
  327. E [ 1 K
  328.      Erase from beginning of screen line to point.
  329.  
  330. E [ 2 K
  331.      Erase whole screen line.
  332.  
  333. 
  334. File: term.info,  Node: Inserting and deleting,  Next: Scrolling,  Prev: Erasing,  Up: Terminal escapes
  335.  
  336. Escape sequences to insert and delete text
  337. ------------------------------------------
  338.  
  339. Esc [ N L
  340.      Insert N (default 1) blank lines.
  341.  
  342. Esc [ N M
  343.      Delete N (default 1) lines.
  344.  
  345. Esc [ N P
  346.      Delete N (default 1) characters.
  347.  
  348. Esc [ N @
  349.      Insert N (default 1) spaces.
  350.  
  351. 
  352. File: term.info,  Node: Scrolling,  Next: Command hook,  Prev: Inserting and deleting,  Up: Terminal escapes
  353.  
  354. Escape sequences to scroll part of the visible window
  355. -----------------------------------------------------
  356.  
  357. Esc D
  358.      Scroll forward one screen line.
  359.  
  360. Esc M
  361.      Scroll backwards one screen line.
  362.  
  363. Esc [ T ; B r
  364.      Set the scrolling region to be from lines T down to line B
  365.      inclusive, where line 1 is the topmost line.
  366.  
  367. 
  368. File: term.info,  Node: Command hook,  Next: Miscellaneous escapes,  Prev: Scrolling,  Up: Terminal escapes
  369.  
  370. Command hook
  371. ------------
  372.  
  373.    If `C-z' is seen, any text up to a following LF is scanned.  The
  374. text in between (not counting the initial C-z or the final LF) is
  375. passed to the function that is the value of `term-command-hook'.
  376.  
  377.    The default value of the `term-command-hook' variable is the
  378. function `term-command-hook', which handles the following:
  379.  
  380. C-z C-z FILENAME:LINENUMBER:IGNORED LF
  381.      Set term-pending-frame to `(cons "FILENAME" LINENUMBER)'.  When
  382.      the buffer is displayed in the current window, show the FILENAME
  383.      in the other window, and show an arrow at LINENUMBER.  Gdb emits
  384.      these strings when invoked with the flag -fullname.  This is used
  385.      by gdb mode; you can also invoke gdb with this flag from shell
  386.      mode.
  387.  
  388. C-z / DIRNAME LF
  389.      Set the directory of the term buffer to DIRNAME
  390.  
  391. C-z ! LEXPR LF
  392.      Read and evaluate LEXPR as a Lisp expression.  The result is
  393.      ignored.
  394.  
  395. 
  396. File: term.info,  Node: Miscellaneous escapes,  Prev: Command hook,  Up: Terminal escapes
  397.  
  398. Miscellaneous escapes
  399. ---------------------
  400.  
  401. C-g (Bell)
  402.      Calls `(beep t)'.
  403.  
  404. Esc 7
  405.      Save cursor.
  406.  
  407. Esc 8
  408.      Restore cursor.
  409.  
  410. Esc [ 47 h
  411.      Switch to the alternate sub-buffer,
  412.  
  413. Esc [ 47 l
  414.      Switch back to the regular sub-buffer,
  415.  
  416.  
  417. 
  418. Tag Table:
  419. Node: Top95
  420. Node: term mode261
  421. Node: Overview1084
  422. Node: Output from the inferior1834
  423. Node: subbuffer3412
  424. Node: altsubbuffer4735
  425. Node: Input to the inferior5760
  426. Node: Connecting to remote computers7278
  427. Node: Paging9183
  428. Node: Terminal escapes9852
  429. Node: Cursor motion10720
  430. Node: Erasing11366
  431. Node: Inserting and deleting12145
  432. Node: Scrolling12527
  433. Node: Command hook12967
  434. Node: Miscellaneous escapes13995
  435. 
  436. End Tag Table
  437.